import {
    ajaxPost,
    showToast
} from '../../utils/util'
Component({
    /**
     * 组件的属性列表
     */
    properties: {
        index: {
            type: String,
            value: 1
        },
    },

    /**
     * 组件的初始数据
     */
    data: {
        index: 1,
        footerSource: [{
                title: '选选',
                url: '/pages/student/list/list',
                img: '/images/icon_footer_icon1.png',
                imgSet: '/images/icon_footer_icon1_set.png',
                fun: 'fun1',
            },
            {
                title: '招聘会',
                url: '',
                img: '/images/icon_footer_icon2.png',
                imgSet: '/images/icon_footer_icon2_set.png',
                fun: 'fun2',
            },
            {
                title: '我的',
                url: '/pages/student/mine/mine',
                img: '/images/icon_footer_icon3.png',
                imgSet: '/images/icon_footer_icon3_set.png',
                fun: 'fun3',
            },
        ],
    },

    /**
     * 组件的方法列表
     */
    methods: {
        /**
         * 
         */
        fun1(e) {
            if (this.data.index == 0) {
                return;
            }
            wx.reLaunch({
                url: '/pages/student/list/list'
            })

        },
        fun2(e) {
            if (this.data.index == 1) {
                return;
            }
            wx.reLaunch({
                url: '/pages/student/home/home'
            })
        },
        fun3(e) {
            if (this.data.index == 2) {
                return;
            }
            wx.reLaunch({
                url: '/pages/student/mine/mine'
            })
        },

        formSubmit(e) {
            if (e.detail.formId == 'the formId is a mock one') {
                return
            }
            ajaxPost('/index/saveFormId', {
                form_id: e.detail.formId
            }, res => {})
        },
    }
})